package zero.tech.core.snow;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "snowflake")
@ConditionalOnProperty(prefix ="snowflake",name="enable",havingValue = "true",matchIfMissing = false )
public class GeneralIdConfig {
	private boolean enable;
	private long dcid;
	private long macid;
	@Bean
	@ConditionalOnProperty(prefix ="snowflake",name="enable",havingValue ="true",matchIfMissing = false )
	public SnowFlake generalId() {
		SnowFlake snowFlake=new SnowFlake(dcid, macid);
		return snowFlake;
	}
	public boolean isEnable() {
		return enable;
	}
	public void setEnable(boolean enable) {
		this.enable = enable;
	}
	public long getDcid() {
		return dcid;
	}
	public void setDcid(long dcid) {
		this.dcid = dcid;
	}
	public long getMacid() {
		return macid;
	}
	public void setMacid(long macid) {
		this.macid = macid;
	}
}
